package org.baojie.raft.node.type;

import org.baojie.raft.node.NodeName;
import org.baojie.raft.store.NodeStore;

public class Follower extends AbstractRole {

    private final NodeName votedFor;
    private final NodeName leader;

    public Follower(NodeName votedFor, NodeName leader, NodeStore store, int term) {
        super(Name.FOLLOWER, store, term);
        this.votedFor = votedFor;
        this.leader = leader;
        store.setVotedFor(votedFor);
    }

    @Override
    public NodeName votedFor() {
        return votedFor;
    }

    @Override
    public NodeName leader() {
        return leader;
    }

}
